package org.redr.canvas;

public class RedRLink {
	/* 
	 * The link class which handles a single link.  
	 * 
	 * These links contain an OutputSocket, InputSocket, bool enabled, and bool none.
	 * Methods in the RedRSignalManager.java class are able to query a list of these (the RedRLinkList.java class)
	 * to find links. 
	 * 
	 */
	
	private OutputSocket output;
	private InputSocket input;
	private Boolean enabled = new Boolean(true);
	private Boolean isNull = new Boolean(false);
	
	public RedRLink(OutputSocket out, InputSocket in, Boolean e, Boolean n)
	{
		setOutputSocket(out);
		setInputSocket(in);
		setEnabled(e);
		setNull(n);
	}
	
	public RedRLink(OutputSocket out, InputSocket in)
	{
		setOutputSocket(out);
		setInputSocket(in);
		setEnabled(true);
		setNull(false);
	}
	
	public void setEnabled(boolean e)
	{
		if (e)
		{
			setEnabledTrue();
		}
		else
		{
			setEnabledFalse();
		}
	}
	
	public void setEnabledTrue()
	{
		enabled = true;
	}
	
	public void setEnabledFalse()
	{
		enabled = false;
	}
	
	public void setNull(boolean e)
	{
		if (e)
		{
			setNullTrue();
		}
		else
		{
			setNullFalse();
		}
	}
	
	public void setNullTrue()
	{
		isNull = true;
	}
	
	public void setNullFalse()
	{
		isNull = false;
	}
	
	public void setOutputSocket(OutputSocket out)
	{
		output = out;
	}
	
	public void setInputSocket(InputSocket in)
	{
		input = in;
	}
	
	
}
